﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="testRadioButtonList.aspx.cs"
    Inherits="test_testRadioButtonList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

 <script language="javascript" type="text/javascript">
     var arrayChecked = new Array();
     //初始化选择状态 
     function InitChecked() {
         var controlID = 'radioEmpRole1';
         var table = document.getElementById(controlID);
         if (table) {
             radioButtonList = table.getElementsByTagName('input');
             for (var i = 0; i < radioButtonList.length; i++) {
                 if (radioButtonList.item(i).checked) {
                     radioButtonList[i] = 1; //被选中 
                 }
                 else {
                     radioButtonList[i] = 0; //未被选中 
                 }
             }
         }
     }
     //设置选择状态 
     function Checked() {
         var controlID = 'radioEmpRole1';
         var table = document.getElementById(controlID);
         if (table) {
             radioButtonList = table.getElementsByTagName('input');
             for (var i = 0; i < radioButtonList.length; i++) {
                 if (radioButtonList.item(i).checked) { //此次点击，该选项被选中，则判断此选项的历史状态，若也是被选中，则会取消选择。 
                     if (arrayChecked[i] == 1) {
                         radioButtonList.item(i).checked = false;
                         arrayChecked[i] = 0;
                     }
                     else {
                         arrayChecked[i] = 1;
                     }
                 }
                 else {
                     arrayChecked[i] = 0;
                 }
             }
         }
     }
 </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <p>
            <asp:Label ID="Label8" runat="server" Width="90" Font-Names="Arial Rounded MT Bold"
                Font-Size="9pt" ForeColor="Blue">請選擇列印格式:</asp:Label>
            <asp:RadioButtonList ID="RadioButtonList2" TabIndex="3" runat="server" Width="120px"
                Height="8px" Font-Names="新細明體" Font-Size="9pt" ForeColor="Blue" RepeatLayout="Flow"
                RepeatDirection="Horizontal" RepeatColumns="2" onclick="getRadioSelectedValue();">
                <asp:ListItem Value="0" Selected="True">明細</asp:ListItem>
                <asp:ListItem Value="1">匯總</asp:ListItem>
            </asp:RadioButtonList>
        </p>
        <div id="ca">
            <asp:CheckBox ID="CheckBox1" TabIndex="10" runat="server" Font-Names="新細明體" Font-Size="9pt"
                ForeColor="Blue" Text="不同客戶(廠商)是否跳頁?"></asp:CheckBox></div>
                
    <script language="javascript" type="text/javascript">
        function getRadioSelectedValue() {
            var radioList = document.getElementById("RadioButtonList2");
            var options = radioList.getElementsByTagName('input');
            var fa;
            for (i = 0; i < options.length; i++) {

                var opt = options[i];
                if (opt.checked) { fa = opt.value; break; }
                
            }

            if (fa == "1")
            { document.getElementById("ca").style.visibility = "hidden"; }
            else
            { document.getElementById("ca").style.visibility = "visible"; }
        } 


    </script>
    </div>
    </form>
</body>
</html>
